package org.administer.contaroller;

import org.administer.dao.CrmCustomerDao;
import org.administer.dao.CrmServiceDao;
import org.administer.pojo.CrmCustomers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/tongji")
public class Tongji {
    @Autowired
    private CrmCustomerDao crmCustomerDao;
    @Autowired
    private CrmServiceDao crmServiceDao;
    @RequestMapping("/index")
    public String index(Map map) throws Exception{
//        已有
        Integer yiyou=crmCustomerDao.kehutongji();
//        流失
        Integer liushi=crmCustomerDao.liushikehutongji();
        map.put("yiyou",yiyou);
        map.put("liushi",liushi);
        System.out.println(yiyou);
        System.out.println(liushi);
        return "tongji/kehutongji";
    }
    @RequestMapping("/fuwu")
    public String fuwu(Map map) throws Exception{
        Integer zixun=crmServiceDao.zixun();
        Integer jianyi=crmServiceDao.jianyi();
        Integer tousu=crmServiceDao.tousu();
        map.put("zixun",zixun);
        map.put("jianyi",jianyi);
        map.put("tousu",tousu);
        return "tongji/wufutongji";
    }
    @RequestMapping("/dengji")
    public String dengji(Map map) throws Exception{
        Integer a=crmCustomerDao.a();
        Integer b=crmCustomerDao.b();
        Integer c=crmCustomerDao.c();
        Integer d=crmCustomerDao.d();
        Integer e=crmCustomerDao.e();
        map.put("a",a);
        map.put("b",b);
        map.put("c",c);
        map.put("d",d);
        map.put("e",e);
        return "tongji/dengji";
    }
}
